//
//  imageDownloadOperation.m
//  Project_ZFR_MUSIC
//
//  Created by 张福润 on 16/2/25.
//  Copyright © 2016年 张福润. All rights reserved.
//

#import "imageDownloadOperation.h"

@implementation imageDownloadOperation
-(void)main{
    dispatch_async(dispatch_get_global_queue(0, 0), ^{
        NSData *data=[NSData dataWithContentsOfURL:[NSURL URLWithString:self.picUrl]];
        NSData *dataBlurPicUrl=[NSData dataWithContentsOfURL:[NSURL URLWithString:self.blurPicUrl]];
        
        UIImage *image=[UIImage imageWithData:data];
        UIImage *imageBlurPicImage=[UIImage imageWithData:dataBlurPicUrl];
        if(self.delegate && [self.delegate respondsToSelector:@selector(getImage:imageDownloadOperation: )]&&[self.delegate respondsToSelector:@selector(getImageBlurPicImage:imageDownloadOperation:)]){
            dispatch_async(dispatch_get_main_queue(), ^{
                [self.delegate getImage:image imageDownloadOperation:self];
                [self.delegate getImageBlurPicImage:imageBlurPicImage imageDownloadOperation:self];
            });
        }
    });
}
@end
